// Copyright (c) 2020 Presto Labs Pte. Ltd.
// Author: linchuan

#pragma once

#include <memory>
#include <string>
#include <vector>

#include "coin2/exchange/base/order/order.h"
#include "coin2/exchange/prex_futures/api_order/native_private_client.h"

namespace coin2::exchange::prex_futures::api_order {

class PrexFuturesRestAsyncAsioSubscriber : public base::order::RestSubscriber {
 public:
  using RestParams = coin2::exchange::order::PrexFuturesRestParams;
  using RestClient = PrexFuturesNativePrivateClient;

 public:
  using RestSubscriber::RestSubscriber;

  auto rest_client() { return dynamic_cast<RestClient*>(rest_client_); }
  const std::string& next_native_symbol();

  void QueryWallet();
  void QueryMargin();
  void QueryPosition();
  void QueryOpenOrders();
  void QueryAllOrders();
  void QueryFill();
  void QueryHistConversions();
  void SubscribeAsync() override;
  void QueryOrderByIds(const std::string& exchange_order_ids, const std::string& proc_order_ids);

 private:
  std::vector<std::string> native_symbol_list_;
  int64_t last_query_order_by_ids_ts_{0};
};

}  // namespace coin2::exchange::prex_futures::api_order
